<template>
    <div class="project-selling-price">
        <div class="title-box">
            <span class="s-tit">{{ title }}</span>
        </div>
        <div class="cost-box">
            <div class="cost-row" v-for="item in list" :key="item.id">
                <div class="cost-name">
                    <span>{{ item.title }}</span>
                </div>
                <el-input
                    v-model="item.price_txt"
                    size="small"
                    class="cost-input"
                    @input="inputFun"
                ></el-input>
                <span class="buf-txt" v-if="item.isod == 1">默认销售价</span>
            </div>
        </div>
    </div>
</template>

<script>
import goodsCtrl from "../../js/project/GoodsCtrl.js";

export default {
    name: "projectsellingPrice",
    data() {
        return {
            title: "售价",
            list: [],
        };
    },
    methods: {
        initData() {
            let data = goodsCtrl.getPriceList() || [];
            let listdata = goodsCtrl.getDatacom("prices") || [];
            data.map((v) => {
                v.price_txt = "";
            });
            this.list = data;
            if (listdata.length > 0) {
                this.list = listdata;
            }
        },
        inputFun() {
            // 准备缓存数据
            goodsCtrl.setDerData("prices", this.list);
        },
    },
};
</script>

<style lang="scss" scoped>
.project-selling-price {
    padding-top: 20px;
    padding-bottom: 20px;
    font-size: 13px;
    .title-box {
        margin-bottom: 10px;
        font-weight: bold;
    }
    .cost-box {
        .cost-row {
            display: flex;
            align-items: center;
            margin-bottom: 10px;
            .cost-name {
                background: #eeeeee;
                width: 95px;
                padding: 5.5px 0;
                text-align: center;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                -webkit-box-orient: vertical;
                -webkit-line-clamp: 1;
            }
            ::v-deep.cost-input {
                width: 160px;
                .el-input__inner {
                    border-radius: 0;
                    border-color: #eeeeee;
                    font-size: 16px;
                    padding: 16px 10px;
                }
            }
            .buf-txt {
                font-size: 12px;
                color: #7289fc;
                margin-left: 5px;
            }
        }
    }
}
</style>